/*
-----------------------------------------------------------------------------
This source file is part of DIVA
The project of Engineering Lab, dept. of CSIE, NTNU.

Copyright (c) 2000-2006 The Software Engineering Lab, dept. of CSIE, NTNU.
-----------------------------------------------------------------------------
Filename:    ubvm_freestyle.h
Description: This file is a vm that collect vms.
-----------------------------------------------------------------------------
*/
/*------------------------------------------------------------*/
#ifndef _ubvm_freestyle_H_
#define	_ubvm_freestyle_H_
/*------------------------------------------------------------*/

#include "DIVA_VM.h"
#include "MovableText.h"
#include <string>
#include "xParameterPack.h"

//using namespace Ogre;

class ubvm_freestyle: public DIVA_VM{
protected:
	
	Ogre::Vector3 getBoundingBoxSize();
	std::vector<DIVA_VM *> _child_vms;
public:
	/// constructor & destructor
	ubvm_freestyle(xParameterPack xpp);
	~ubvm_freestyle();

	/// draw - for animation or not.
	//void draw();
	std::string getVMType() { return std::string("primitive"); }

	// the overriden method of DIVA_VM
	void load_3Dresources();
	void reg_event_entity();
	void set_default_values();
	void init_private_attrs_started(); // no more private attributes
	void init_color_and_transparency(); // the function of color should be overridden 
	void update_color_and_transparency() ;

	void VMPicked(Ogre::Real x,Ogre::Real y,Ogre::Real z);

	/** this method of freestyle is overriden, so that the dragged event is passed to childvm
	    and allow its child vm to reset their position */
	void VMDragged(Ogre::Real screenx,Ogre::Real screeny, Ogre::Real x,Ogre::Real y,Ogre::Real z);
	void VMValueUpdated();
	void VMSetVisible(bool vis);

	bool isSubComponent(DIVA_VM *vm) ;
	// the overridden method of OgreVM
	void setBodyScale(Ogre::Vector3);
	void scaleBodyToAbsSize(Ogre::Vector3 v);
	Ogre::Vector3 getOriginalBodySize();
	Ogre::Vector3 getActualSize();
	bool isBodyScaleWrtSceneNode();
	Ogre::Vector3 getBodyScale();

	// 暫時的function - 將integer轉成string
	std::string intToString(int its){
		std::stringstream ss;
		std::string str;

		ss << its;
		str = ss.str();
		ss.str("");

		return str;
	}

};
/*------------------------------------------------------------*/
#endif	//#ifndef _ubvm_freestyle_H_
/*------------------------------------------------------------*/